import { Request, Response } from 'express';

/**
 * 登录拦截器
 * @constructor
 */
export const AuthMiddleware = (/*可以往中间件中传递参数*/) => {
  return (req, res, next: any) => {
    console.log('auth中间件start', req.signedCookies.auth);
    if(req.url !== '/user/login' && !req.signedCookies.auth){
      res.redirect('/user/login')
    }
    next();
    console.log('auth中间件end');
  }
}
